#include <iostream>
#include <cstring>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <bitset>
#include <utility>
using namespace std;

#define mm(a, n) memset(a, n, sizeof a)
#define mk(a, b) make_pair(a, b)

const double eps = 1e-6;
const int INF = 0x3f3f3f3f;

typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef pair<int, LL> PIL;

inline void quickread() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
}

const int N = 1010;

int c, n, m;
int nums[N];
bool st[N];

// 1. 直接模拟栈
// 2. 用stack直接模拟
inline void solution() {
    cin >> c >> n >> m;
    while (m -- ) {
        mm(st, false);
        bool flag = false;

        for (int i = 0; i < n; i ++ ) cin >> nums[i];
        if (nums[0] > c) {
            cout << "NO" << endl;
            continue;
        }
        st[nums[0]] = true;
        // cap：当前stack的容量，top表示栈顶元素，next表示下一个需要添加的元素
        int cap = nums[0] - 1, top = nums[0] - 1, next = nums[0] + 1;

        for (int i = 1; i < n; i ++ ) {
            
            if (nums[i] == top) top --, cap--, st[nums[i]] = true;
            else if (nums[i] < top) {
                int j;
                for (j = top; j >= 0; j -- ) 
                    if (st[j] == false) break;
                if (j == nums[i]) {
                    st[j] = true;
                    top = nums[i - 1];
                    cap -- ;
                } else {
                    flag = true;
                    break;
                } 
            }

            if (nums[i] == next) {
                if (cap + 1 <= c)
                    next ++, st[nums[i]] = true;
                else {
                    flag = true;
                    break;
                }
            }
            else if (nums[i] > next) {
                if (cap + nums[i] - next + 1 <= c) {
                    st[nums[i]] = true;
                    top = nums[i] - 1;
                    cap += nums[i] - next;
                    next = nums[i] + 1;
                } else {
                    flag = true;
                    break;
                }
            }


        }
        if (!flag)
            cout << "YES" << endl;
        else
            cout << "NO" << endl;
    }
}

int main() {
    freopen("input.txt", "r", stdin);
    quickread();
    solution();
    return 0;
}